<template>
    <div class="test">
        <h2>姓名：{{ name }}</h2>
        <h2>年龄：{{ age }}</h2>
        <button @click="fun1">修改姓名</button>
        <button @click="fun2">年龄+2</button>
        <button @click="fun3">显示电话号码</button>
    </div>
</template>

<script lang="ts" setup name="Test">
import { ref } from 'vue';
let name = ref('zhang-san');
let age = ref(18);
let num = ref('12399999999')
function fun1() {
    name.value = '张三';
    console.log(name)
}
function fun2() {
    age.value += 2
    console.log(age)
}
function fun3() {
    alert(num.value)
}
</script>

<style scoped></style>